package com.chidopi.cdf.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.chidopi.cdf.dao.IBaseDao;
import com.chidopi.cdf.service.IBaseService;

public class BaseServiceImpl<T> implements IBaseService<T> {
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	protected IBaseDao<T> baseDao;

	public int delete(T t) throws Exception {
		return this.baseDao.delete(t);
	}

	public List<T> find(String sqlWhere, Object... args) throws Exception {
		logger.debug(sqlWhere);
		return this.baseDao.find(sqlWhere, args);
	}

	public T findById(Object id) throws Exception {
		return this.baseDao.findById(id);
	}

	public int insert(T t) throws Exception {
		return this.baseDao.insert(t);
	}

	public int update(T t) throws Exception {
		return this.baseDao.update(t);
	}

	public int getNextSequence() throws Exception {
		return this.baseDao.getSeqNextValue();
	}

}
